<?php namespace Home\Controller; 
//use Hdphp\Controller\Controller;
class IndexController extends CommonController{
//	private $model;
	public function __init()
	{

	}
	
    //动作
    public function index(){
//  	p($_SESSION['code']);
		//正在流行
		$goodsModel=new \Common\Model\Goods;
		$goodsData=$goodsModel->where('cid=46')->get();
		View::with('goodsData',$goodsData);
		
		//新品精选
		$goodsData1=$goodsModel->where('cid=47')->get();
		View::with('goodsData1',$goodsData1);
		//一级菜单
		$cateModel=new \Common\Model\Cate;
		$cateName=$cateModel->where('tid=14')->where('pid=0')->get();
		$cateData=$cateModel->where('tid=14')->where('pid!=0')->get();
		foreach($cateName as $k=>$v){
			foreach($cateData as $va){
				if($va['pid']==$v['cid']){
					$cateName[$k]['son'][]=$va['cname'];
				}
			}
		}
//		$cate=array();
//		$cate=$cateName;
		foreach ($cateName as $k => $v) {
			$cateName[$k]['son1']=array_slice($v['son'], 0,9);
		}
//		p($cateName);
//		p($cate);
//		p($cateName);
//		p($cateData);
//		die;
		
		View::with('cateName',$cateName);
      	View::make();
    }

}
